﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Views/Shared/SiteAdmin.Master" Inherits="System.Web.Mvc.ViewPage<Beeldbankmvc.ViewModels.SearchViewModel>" %>

<%@ Import Namespace="Beeldbankmvc.Code" %>
<%@ Import Namespace="Beeldbankmvc.Controllers" %>
<%@ Import Namespace="Beeldbankmvc.Models" %>

<asp:Content ID="Content1" ContentPlaceHolderID="TitleContent" runat="server">Foto's en video's zoeken op status</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <script src="<%=AppHelper.getContent("~/Content/js/searchScripts.js") %>" type="text/javascript"></script>
    <% Html.RenderAction("AdminMenu", "Miscellaneous"); %>
    <h1>Foto's en video's zoeken op status</h1>
    <p>
        <a id="linkbutton" href="<%:Url.Action("FieldSearch", "Search", new { statusId = 23715, OnlyMyItems = true, UserId = Convert.ToString(Request.QueryString["UserId"]) }) %>">Nieuw (<%: Model.numberOfNew %>)</a>&nbsp;
        <a id="linkbutton" href="<%:Url.Action("FieldSearch", "Search", new { statusId = 23713, OnlyMyItems = true, UserId = Convert.ToString(Request.QueryString["UserId"]) }) %>">Verborgen (<%: Model.numberOfHidden %>)</a>&nbsp;
        <a id="linkbutton" href="<%:Url.Action("FieldSearch", "Search", new { statusId = 23717, OnlyMyItems = true, UserId = Convert.ToString(Request.QueryString["UserId"]) }) %>">Publiceerbaar (<%: Model.numberOfReadyForPublish %>)</a>&nbsp;
        <a id="linkbutton" href="<%:Url.Action("FieldSearch", "Search", new { statusId = 23716, OnlyMyItems = true, UserId = Convert.ToString(Request.QueryString["UserId"]) }) %>">Intern gepubliceerd (<%: Model.numberOfPublishedInternal %>)</a>&nbsp;
        <a id="linkbutton" href="<%:Url.Action("FieldSearch", "Search", new { statusId = 11911, OnlyMyItems = true, UserId = Convert.ToString(Request.QueryString["UserId"]) }) %>">Extern gepubliceerd (<%: Model.numberOfPublishedExternal %>)</a>&nbsp;
        <a id="linkbutton" href="<%:Url.Action("FieldSearch", "Search", new { statusId = 23718, OnlyMyItems = true, UserId = Convert.ToString(Request.QueryString["UserId"]) }) %>">Afgewezen (<%: Model.numberOfRejected %>)</a>
        <%
        if (Roles.IsUserInRole("Administrator"))
        { %>
            &nbsp;<a id="linkbutton" href="<%:Url.Action("FieldSearch", "Search", new { statusId = 23719, OnlyMyItems = true, UserId = Convert.ToString(Request.QueryString["UserId"]) }) %>">Geen Preview (<%: Model.numberOfNoThumbNail%>)</a>
            &nbsp;<a id="linkbutton" href="<%:Url.Action("FieldSearch", "Search", new { statusId = 23720, OnlyMyItems = true, UserId = Convert.ToString(Request.QueryString["UserId"]) }) %>">Geen MapNr (<%: Model.numberOfNoMapNumber%>)</a>
        <%
        } %>
    </p>
    <br />    
    <div id="searchpage">
        <form method="get" action="">
        <fieldset>
            <legend>Zoek opties voor mediaobjecten</legend>
            <div class="searchpagekolom">
                <p>
                    <label><strong>Toon</strong></label>
                    <br />
                <%  if (String.IsNullOrEmpty(Request.QueryString["typeAnaloog"]) &&
                        String.IsNullOrEmpty(Request.QueryString["typeDigitaal"]) &&
                        String.IsNullOrEmpty(Request.QueryString["typeVideoAnimation"]) &&
                        String.IsNullOrEmpty(Request.QueryString["typeMapIllustration"]))
                    { %>
                        <input type="checkbox" id="typeAnaloog" name="typeAnaloog" value="true" checked="checked" /><label for="typeAnaloog">Analoge foto</label><br />
                        <input type="checkbox" id="typeDigitaal" name="typeDigitaal" value="true" checked="checked" /><label for="typeDigitaal">Digitale foto</label><br />
                        <input type="checkbox" id="typeVideoAnimation" name="typeVideoAnimation" value="true" checked="checked" /><label for="typeVideoAnimation">Video / Animatie</label><br />
                        <input type="checkbox" id="typeMapIllustration" name="typeMapIllustration" value="true" checked="checked" /><label for="typeMapIllustration">Kaart / Illustratie</label><br />
                <%  }
                    else
                    {%>
                        <input type="checkbox" id="typeAnaloog" name="typeAnaloog" value="true" <% if(Convert.ToBoolean(Request.QueryString["typeAnaloog"])){%> checked="checked" <%} %> /><label for="typeAnaloog">Analoge foto</label><br />
                        <input type="checkbox" id="typeDigitaal" name="typeDigitaal" value="true" <% if(Convert.ToBoolean(Request.QueryString["typeDigitaal"])){%> checked="checked" <%} %> /><label for="typeDigitaal">Digitale foto</label><br />
                        <input type="checkbox" id="typeVideoAnimation" name="typeVideoAnimation" value="true" <% if(Convert.ToBoolean(Request.QueryString["typeVideoAnimation"])){%> checked="checked" <%} %> /><label for="typeVideoAnimation">Video / Animatie</label><br />
                        <input type="checkbox" id="typeMapIllustration" name="typeMapIllustration" value="true" <% if(Convert.ToBoolean(Request.QueryString["typeMapIllustration"])){%> checked="checked" <%} %> /><label for="typeMapIllustration">Kaart / Illustratie</label><br />
                <%
                    } %>
                </p>
            </div>
            <div class="searchpagekolom">
                <p>
                    <label for="StatusId"><strong>Status</strong></label>
                    <br />
                    <%: Html.DropDownList("StatusId")%>
                    <br />
                    <label for="CollectionId"><strong>Thema</strong></label>
                    <br />
                    <%: Html.DropDownList("CollectionId", (IEnumerable<SelectListItem>)ViewData["Menu"], "-- Selecteren --")%>
                    <br />
                    <label for="OrderBy"><strong>Sorteren</strong></label>
                    <br />
                    <select id="OrderBy" name="OrderBy">
                        <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("3") == true){%>
                            selected="selected" <%}%> value="3">op Relevantie</option>
                        <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("1") == true){%>
                            selected="selected" <%}%> value="1">op Inventaris</option>
                        <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("5") == true){%>
                            selected="selected" <%}%> value="5">op Inventaris aflopend</option>
                        <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("2") == true){%>
                            selected="selected" <%}%> value="2">op Datum</option>
                        <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("6") == true){%>
                            selected="selected" <%}%> value="6">op Datum aflopend</option>
                        <option <% if (Request.QueryString["OrderBy"] == null || Convert.ToString(Request.QueryString["OrderBy"]).Equals("7") == true){%>
                            selected="selected" <%}%> value="7">op Meest recent gewijzigd</option>
                        <option <% if (Request.QueryString["OrderBy"] != null && Convert.ToString(Request.QueryString["OrderBy"]).Equals("8") == true){%>
                            selected="selected" <%}%> value="8">op Meest recent toegevoegd</option>
                    </select><br />
                </p>
            </div>
            <div class="searchpagekolom">
                <p>
                    <label for="fromDate"><strong>Datum van</strong></label>
                <%  if (Request.QueryString["fromDate"] != null)
                    { %>
                        <input type="text" id="fromDate" name="fromDate" value="<%:Request.QueryString["fromDate"] %>" />
                <%  }
                    else
                    { %>
                        <input type="text" id="fromDate" name="fromDate" value="1-1-1900" />
                <%  } %>
                    <label for="toDate"><strong>Datum tot</strong></label>
                <%  if (Request.QueryString["toDate"] != null)
                    { %>
                        <input type="text" id="toDate" name="toDate" value="<%:Request.QueryString["toDate"] %>" />
                <%  }
                    else
                    { %>
                        <input type="text" id="toDate" name="toDate" value="<%: DateTime.Now.ToShortDateString() %>" />
                <%  }
                    if (Roles.IsUserInRole("Administrator"))
                    { %>
                        <br />
                        <label for="UserId"><strong>Beheerders</strong></label>
                        <br />
                        <%: Html.DropDownList("UserId", (IEnumerable<SelectListItem>)ViewData["Menu"], "-- Selecteren --")%>
                <%  } %>
                </p>
            </div>
            <div class="showing">
                <label><strong><%: Model.NumberOfResults %> resultaten gevonden voor:</strong></label><br />
                <input type="text" id="searchBox" name="SearchCriteria" value="<%:Request.QueryString["SearchCriteria"] %>" title="Geef een of meerdere zoektermen op."/><button class="searchbutton" title="Geef een of meerdere zoektermen op, of zoek op nummer met IDxxx waarbij xxx het gezochte foto- of filenummer bevat." type="submit">Zoeken</button>
            </div>
        </fieldset>
        </form>
        <div class="divshowing">
            <div class="paginas">
                <p>
                    <%
                        int startPagingFrom = Convert.ToInt32(Request.QueryString["startPagingFrom"]);
                        int currentPage = Convert.ToInt32(Request.QueryString["page"]);

                        int imagesPerPage = 20;
                        if (Request.QueryString["displayMode"] != null)
                        {
                            switch (int.Parse(Request.QueryString["displayMode"]))
                            {
                                case 1:
                                    imagesPerPage = 10;
                                    break;
                                case 2:
                                    imagesPerPage = 20;
                                    break;
                                case 3:
                                    imagesPerPage = 80;
                                    break;
                            }
                        }
                        int i = startPagingFrom;
                        int maxPages = 10 + startPagingFrom;

                        if (startPagingFrom >= 10)
                        {
                    %>
                    <%:Html.ActionLink("<<", "FieldSearch", "Search", new{
                        startPagingFrom = startPagingFrom-10,
                        page = i,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeanaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        userId = Request.QueryString["userId"],
                        showInternalItems = Request.QueryString["showInternalItems"]
                        }, null)%>
                    <%
                        }

                        if (startPagingFrom >= 1)
                        {    
                    %>
                    <%:Html.ActionLink("<", "FieldSearch", "Search", new
                        {
                        startPagingFrom = startPagingFrom-1,
                        page = i,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeanaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        userId = Request.QueryString["userId"],
                        showInternalItems = Request.QueryString["showInternalItems"]
                        }, null)%>
                    <%             
                        }
                        while (Model.NumberOfResults > i * imagesPerPage && i < maxPages)
                        {
                    %>
                    <%:Html.ActionLink(i.ToString(), "FieldSearch", "Search", new
                        {
                        startPagingFrom = startPagingFrom, 
                        page = i,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeanaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        userId = Request.QueryString["userId"],
                        showInternalItems = Request.QueryString["showInternalItems"]
                        }, null)%>&nbsp;
                    <%
                        i++;
                        }
                    %>
                    <%
                        if (Model.NumberOfResults / imagesPerPage > currentPage)
                        { 
                    %>
                    <%:Html.ActionLink(">", "FieldSearch", "Search", new
                    {
                        startPagingFrom = startPagingFrom + 1,
                        page = currentPage + 1,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeanaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        userId = Request.QueryString["userId"],
                        showInternalItems = Request.QueryString["showInternalItems"]
                    }, null)%>
                    <% } %>
                    <%
                       if (Model.NumberOfResults > i * imagesPerPage)
                       {        
                    %>
                    <%:Html.ActionLink(">>", "FieldSearch", "Search", new
                    {
                        startPagingFrom = startPagingFrom + 10,
                        page = i,
                        SearchCriteria = Request.QueryString["SearchCriteria"],
                        typeanaloog = Request.QueryString["typeAnaloog"],
                        typeDigitaal = Request.QueryString["typeDigitaal"],
                        typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                        typeMapIllustration = Request.QueryString["typeMapIllustration"],
                        onlyMyItems = Request.QueryString["onlyMyItems"],
                        OrderBy = Request.QueryString["OrderBy"],
                        fromDateCheck = Request.QueryString["fromDateCheck"],
                        fromDate = Request.QueryString["fromDate"],
                        toDateCheck = Request.QueryString["toDateCheck"],
                        toDate = Request.QueryString["toDate"],
                        displayMode = Request.QueryString["displayMode"],
                        collectionId = Request.QueryString["collectionId"],
                        statusId = Request.QueryString["statusId"],
                        userId = Request.QueryString["userId"],
                        showInternalItems = Request.QueryString["showInternalItems"]
                    }, null)%>
                    <% } %>
                </p>
            </div>
            <div class="weergave">
                <p>
                    <%
                        string listButton = "";
                        string galleryButton = "";
                        string gridButton = "";

                        listButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-list-off.gif") + "\" alt=\"Detail weergave\" />";
                        galleryButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-gallery-off.gif") + "\" alt=\"Overzicht weergave\"/>";
                        gridButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-grid-off.gif") + "\" alt=\"Lichtbak weergave\"/>";

                        if (Request.QueryString["displayMode"] != null)
                        {
                            switch (Request.QueryString["displayMode"])
                            {
                                case "1":
                                    listButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-list-on.gif") + "\" alt=\"Detail weergave\" />"; 
                                    break;
                                case "2":
                                    galleryButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-gallery-on.gif") + "\" alt=\"Overzicht weergave\" />"; 
                                    break;
                                case "3":
                                    gridButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-grid-on.gif") + "\" alt=\"Lichtbak weergave\" />"; 
                                    break;
                            }
                        }
                        else
                        {
                            galleryButton = "<img src=\"" + AppHelper.getContent("~/Content/images/result-gallery-on.gif") + "\" alt=\"Overzicht weergave\" />"; 
                        }
                    %>
                    <% 
                        // todo: move this logic to the model
                        // compensation for amount of images per page
                        int startPagingFrom_ToType1 = 0;
                        int currentPage_ToType1 = 0;

                        int startPagingFrom_ToType2 = 0;
                        int currentPage_ToType2 = 0;

                        int startPagingFrom_ToType3 = 0;
                        int currentPage_ToType3 = 0;

                        if (Request.QueryString["displayMode"] != null)
                        {
                            switch (int.Parse(Request.QueryString["displayMode"]))
                            {
                                case 1:
                                    startPagingFrom_ToType1 = startPagingFrom;
                                    currentPage_ToType1 = currentPage;

                                    startPagingFrom_ToType2 = startPagingFrom / 2;
                                    currentPage_ToType2 = currentPage / 2;

                                    startPagingFrom_ToType3 = startPagingFrom / 4;
                                    currentPage_ToType3 = currentPage / 4;
                                    break;
                                case 2:
                                    startPagingFrom_ToType1 = startPagingFrom * 2;
                                    currentPage_ToType1 = currentPage * 2;

                                    startPagingFrom_ToType2 = startPagingFrom;
                                    currentPage_ToType2 = currentPage;

                                    startPagingFrom_ToType3 = startPagingFrom / 2;
                                    currentPage_ToType3 = currentPage / 2;
                                    break;
                                case 3:
                                    startPagingFrom_ToType1 = startPagingFrom * 4;
                                    currentPage_ToType1 = currentPage * 4;

                                    startPagingFrom_ToType2 = startPagingFrom * 2;
                                    currentPage_ToType2 = currentPage * 2;

                                    startPagingFrom_ToType3 = startPagingFrom;
                                    currentPage_ToType3 = currentPage;
                                    break;
                            }
                        }
                    %>
                    <%=Html.ActionLink("_ph_", "FieldSearch", "Search", new
                        {
                            startPagingFrom = startPagingFrom_ToType1,
                            page = currentPage_ToType1,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeanaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = "1",
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            userId = Request.QueryString["userId"],
                            showInternalItems = Request.QueryString["showInternalItems"]
                        }, null).ToString().Replace("_ph_", listButton)%>&nbsp;
                    <%=Html.ActionLink("_ph_", "FieldSearch", "Search", new
                        {
                            startPagingFrom = startPagingFrom_ToType2,
                            page = currentPage_ToType2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeanaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = "2",
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            userId = Request.QueryString["userId"],
                            showInternalItems = Request.QueryString["showInternalItems"]
                        }, null).ToString().Replace("_ph_", galleryButton)%>&nbsp;
                    <%=Html.ActionLink("_ph_", "FieldSearch", "Search", new
                        {
                            startPagingFrom = startPagingFrom_ToType3,
                            page = currentPage_ToType3,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeanaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = "3",
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            userId = Request.QueryString["userId"],
                            showInternalItems = Request.QueryString["showInternalItems"]
                        }, null).ToString().Replace("_ph_", gridButton)%>&nbsp;
                </p>
            </div>
        </div>
        <%
            int width = 150;
            int cellWidth;
            int fotosPerRegel = 4;

            if (Request.QueryString["displayMode"] != null)
            {
                switch (int.Parse(Request.QueryString["displayMode"]))
                {
                    case 1:
                        width = 188;
                        fotosPerRegel = 1;
                        cellWidth = 663;
                        break;
                    case 2:
                        width = 150;
                        fotosPerRegel = 4;
                        cellWidth = 165;
                        break;
                    case 3:
                        width = 65;
                        fotosPerRegel = 8;
                        cellWidth = 84;
                        break;
                }
            }
        %>
        <% 
            int index = 0;
            foreach (BEELDBANK_MEDIAOBJECT mediaobject in Model.mediaobjects)
            {
        %>
        <% 
            if (Request.QueryString["displayMode"] != null && int.Parse(Request.QueryString["displayMode"]) == 1)
            {
        %>
        <div class="lijstlinks">
            <div class="lijstlinks">
                <%=Url.Image<HomeController>(c => c.DisplayThumb(mediaobject.Id.ToString()), width, mediaobject.Omschrijving, mediaobject.Omschrijving, AppHelper.getContent("~/MediaObject/Details/" + AppHelper.convertToUrlTitle(mediaobject.Omschrijving, mediaobject.Id) + "?resultType=" + TempData["resultIdType"] + "&resultList=" + TempData["resultIdList"]))%>
            </div>
            <div class="lijstweergave">
                <div class="listdata">
                    <a href="<%= Url.Action("Edit", "MediaObject", new RouteValueDictionary(new { id = mediaobject.Id })) %>">
                        <img src="<%=AppHelper.getContent("~/Content/images/edit.gif") %>" title="Wijzig mediaobject" alt="Wijzig mediaobject" /></a>&nbsp;&nbsp;
                    <a href="<%= Url.Action("Delete", "MediaObject", new RouteValueDictionary(new { id = mediaobject.Id })) %>">
                        <img src="<%=AppHelper.getContent("~/Content/images/delete.gif") %>" title="Verwijder mediaobject" alt="Verwijder mediaobject" onclick="javascript:return confirm('Dit media object zal permanent worden verwijderd, weet u het zeker?');" /></a>
                </div>
                <div class="lijsttitel">
                    <strong>Inventaris nr.</strong>
                </div>
                <div class="lijstdata">
                    <%: mediaobject.Titel%>
                </div>
                <div class="lijsttitel">
                    <strong>Omschrijving</strong>
                </div>
                <div class="lijstdata">
                    <%= mediaobject.Omschrijving%>
                </div>
                <div class="lijsttitel">
                    <strong>Trefwoorden</strong>
                </div>
                <div class="lijstdata">
                    <%: mediaobject.Trefwoorden%>
                </div>
                <div class="lijsttitel">
                    <strong>Datum</strong>
                </div>
                <div class="lijstdata">
                    <%: String.Format("{0:d}", mediaobject.Datum_Realisatie)%>
                </div>
            </div>
        </div>
        <%
            }
            else
            {
        %>
        <% if (index == 0)
           {%>
        <div class="weergavefoto">
            <% } %>
            <% else if (index % fotosPerRegel == 0)
                { %>
        </div>
        <div class="weergavefoto">
            <% } %>
            <div class="weergavefoto">
                <%=Url.Image<HomeController>(c => c.DisplayThumb(mediaobject.Id.ToString()), width, mediaobject.Omschrijving, mediaobject.Omschrijving, AppHelper.getContent("~/MediaObject/Details/" + AppHelper.convertToUrlTitle(mediaobject.Omschrijving, mediaobject.Id) + "?resultType=" + TempData["resultIdType"] + "&resultList=" + TempData["resultIdList"]))%>
                <% 
                    // only display title for viewmode2
                    if ((Request.QueryString["displayMode"] != null && int.Parse(Request.QueryString["displayMode"]) == 2) || Request.QueryString["displayMode"] == null)
                    { %>
                <div>
                    <%: Html.ActionLink(Beeldbankmvc.Helpers.Tools.getMaxLengthVersion(mediaobject.Titel, 20), "Details", "MediaObject", new { id = AppHelper.convertToUrlTitle(mediaobject.Omschrijving, mediaobject.Id) }, null)%>
                    &nbsp;
                    <% if ((Roles.IsUserInRole("Administrator")) || ((mediaobject.GroepRechten != null) && Roles.IsUserInRole(mediaobject.GroepRechten)) || (mediaobject.modifiedby.ToLower() == Model.currentUserName.ToLower()) || (mediaobject.createdby.ToLower() == Model.currentUserName.ToLower()))
                       { %>
                    <br />
                    <a href="<%= Url.Action("Edit", "MediaObject", new RouteValueDictionary(new { id = mediaobject.Id,  resultType = TempData["resultIdType"], resultList = TempData["resultIdList"]})) %>">
                        <img src="<%=AppHelper.getContent("~/Content/images/edit.gif") %>" title="Wijzig mediaobject" alt="Wijzig mediaobject" /></a>&nbsp;&nbsp;
                    <a href="<%= Url.Action("Delete", "MediaObject", new RouteValueDictionary(new { id = mediaobject.Id })) %>">
                        <img src="<%=AppHelper.getContent("~/Content/images/delete.gif") %>" title="Verwijder mediaobject" alt="Verwijder mediaobject" onclick="javascript:return confirm('Dit media object zal permanent worden verwijderd, weet u het zeker?');" /></a>
                    <% } %>
                </div>
                <% } %>
            </div>
            <% } %>
            <% 
            index++;
            } %>
            <% 
                if (Request.QueryString["displayMode"] != "1" && Model.NumberOfResults != 0)
                {
            %>
        </div>
        <% } %>
        <div class="divshowing">
            <div class="paginas">
                <p>
                    <%
                        int startPaging2From = Convert.ToInt32(Request.QueryString["startPagingFrom"]);
                        int current2Page = Convert.ToInt32(Request.QueryString["page"]);

                        int images2PerPage = 20;
                        if (Request.QueryString["displayMode"] != null)
                        {
                            switch (int.Parse(Request.QueryString["displayMode"]))
                            {
                                case 1:
                                    images2PerPage = 10;
                                    break;
                                case 2:
                                    images2PerPage = 20;
                                    break;
                                case 3:
                                    images2PerPage = 80;
                                    break;
                            }
                        }
                        int i2 = startPaging2From;
                        int max2Pages = 10 + startPaging2From;

                        if (startPaging2From >= 10)
                        {
                    %>
                    <%:Html.ActionLink("<<", "FieldSearch", "Search", new
                        {
                            startPagingFrom = startPaging2From-10,
                            page = i2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeanaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            userId = Request.QueryString["userId"],
                            showInternalItems = Request.QueryString["showInternalItems"]
                        }, null)%>
                    <%
                        }

                        if (startPaging2From >= 1)
                        {    
                    %>
                    <%:Html.ActionLink("<", "FieldSearch", "Search", new
                        {
                            startPagingFrom = startPaging2From-1,
                            page = i2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeanaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            userId = Request.QueryString["userId"],
                            showInternalItems = Request.QueryString["showInternalItems"]
                        }, null)%>
                    <%             
                        }
                        while (Model.NumberOfResults > i2 * images2PerPage && i2 < maxPages)
                        {
                    %>
                    <%:Html.ActionLink(i2.ToString(), "FieldSearch", "Search", new
                        {
                            startPagingFrom = startPaging2From, 
                            page = i2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeanaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            userId = Request.QueryString["userId"],
                            showInternalItems = Request.QueryString["showInternalItems"]
                        }, null)%>&nbsp;
                    <%
                        i2++;
                        }
                    %>
                    <%
                        if (Model.NumberOfResults / images2PerPage > currentPage)
                        { 
                    %>
                    <%:Html.ActionLink(">", "FieldSearch", "Search", new
                        {
                            startPagingFrom = startPaging2From + 1,
                            page = currentPage + 1,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeanaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            userId = Request.QueryString["userId"],
                            showInternalItems = Request.QueryString["showInternalItems"]
                        }, null)%>
                    <% } %>
                    <%
                        if (Model.NumberOfResults > i2 * images2PerPage)
                        {        
                    %>
                    <%:Html.ActionLink(">>", "FieldSearch", "Search", new
                        {
                            startPagingFrom = startPaging2From + 10,
                            page = i2,
                            SearchCriteria = Request.QueryString["SearchCriteria"],
                            typeanaloog = Request.QueryString["typeAnaloog"],
                            typeDigitaal = Request.QueryString["typeDigitaal"],
                            typeVideoAnimation = Request.QueryString["typeVideoAnimation"],
                            typeMapIllustration = Request.QueryString["typeMapIllustration"],
                            onlyMyItems = Request.QueryString["onlyMyItems"],
                            OrderBy = Request.QueryString["OrderBy"],
                            fromDateCheck = Request.QueryString["fromDateCheck"],
                            fromDate = Request.QueryString["fromDate"],
                            toDateCheck = Request.QueryString["toDateCheck"],
                            toDate = Request.QueryString["toDate"],
                            displayMode = Request.QueryString["displayMode"],
                            collectionId = Request.QueryString["collectionId"],
                            statusId = Request.QueryString["statusId"],
                            userId = Request.QueryString["userId"],
                            showInternalItems = Request.QueryString["showInternalItems"]
                        }, null)%>
                    <% } %>
                </p>
            </div>
        </div>
    </div>
    <!-- Last cached: <%: DateTime.Now %> -->
</asp:Content>
